import jakarta.servlet.*;
import jakarta.servlet.http.*;
import jakarta.servlet.annotation.*;

import java.io.IOException;

/*
*   ServletConfig
*       1.作用：获取servlet程序的初始化参数
*       2.获取方式：
*           1.通过servlet对象获取
*               ServletConfig servletConfig = this.getServletConfig();
*           2.通过request对象获取
*               ServletConfig servletConfig = request.getServletConfig();
* */
public class ServletConfigDemo01 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ServletConfig servletConfig = this.getServletConfig();
        System.out.println(servletConfig.getInitParameter("charset"));
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }
}
